n=int(input())
A_word={}
for i in range(2**n):
  A_word[('0'*n+bin(i)[2:])[-n:]]=input()
B=input()
C=len(B)//n
#判断输入的密文序列符合定义的密文系统
try:
  if len(B)%n==0:
      l=[A_word[B[n*i: n*(i+1)]] for i in range(C)]
#符合则输出破解得到的明文序列
      print(*l)
  else: 
#不符合则输出“Error, please check your input.”
      print('Error, please check your input.')
except KeyError: 
  print('Error, please check your input.')